import { Entity, Column, Index } from 'typeorm';
import { BaseEntity } from '../../base/entity/base';

/**
 * 会员信息
 */
@Entity('member_info')
export class MemberInfoEntity extends BaseEntity {
  @Column({ comment: '头像', nullable: true })
  avatarUrl: string;

  @Column({ comment: '姓名', nullable: true })
  name: string;

  @Column({ comment: '昵称', nullable: true })
  nickName: string;

  @Column({ comment: '性别', dict: ['未知', '男', '女'], default: 0 })
  gender: number;

  @Index({ unique: true })
  @Column({ comment: '手机号', nullable: true, length: 20 })
  phone: string;

  @Column({ comment: '生日', type: 'date', nullable: true })
  birthday: Date;

  @Index()
  @Column({ comment: '会员等级ID', nullable: true })
  gradeId: number;

  @Column({ comment: '积分值', default: 0 })
  score: number;

  @Column({ comment: '注册时间', type: 'varchar' })
  registerTime: Date;

  @Column({ comment: '最后登录时间', type: 'varchar', nullable: true })
  lastLoginTime: Date;

  @Column({ comment: '账号状态', dict: ['禁用', '正常'], default: 1 })
  status: number;

  @Column({ comment: '备注', nullable: true })
  remark: string;
}
